/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.ufrgs.inf.prav.interop.jsf.components;

import java.io.IOException;
import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;

/**
 *
 * @author Fernando
 */
public class VarInComponent extends PravBaseComponent{

    public static final String COMPONENT_FAMILY = "PRAV_VARIN";
    public static final String COMPONENT_TYPE = "PRAV_VARIN";

    private String name;

    public VarInComponent(){
        
    }

    @Override
    public void encodeBegin(FacesContext context) throws IOException {
        ResponseWriter writer =
			context.getResponseWriter();

        String value = (String)context.
                getExternalContext().getRequestMap().get(name);

        //atts
        if (value != null){
            hideInnerComponents();
            writer.write(value);
        }


        writer.flush();
	}

    @Override
    public void encodeEnd(FacesContext context)
            throws IOException {
    }

    @Override
    public void decode(FacesContext context) {
    }

    // <editor-fold defaultstate="collapsed" desc="Getters and Setters">
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    // </editor-fold>


}
